package com.foreknow.elm.controller;

import com.foreknow.elm.po.User;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.service.impl.BusinessServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

public class BusinessController {
    /**
     * 根据点餐分类编号查询所属商家信息
     * @param request
     * @return
     */
    public Object listBusinessByOrderTypeId(HttpServletRequest request) {
//        List<User> list = new ArrayList<>();
//        User user = new User();
//        user.setId(100);
//        user.setName("fender");
//        user.setPass("123456");
//        list.add(user);
        int orderTypeId = Integer.parseInt(request.getParameter("orderTypeId"));
        BusinessService service = new BusinessServiceImpl();
        return service.listBusinessByOrderTypeId(orderTypeId);
    }

    /**
     * 根据商家编号查询商家信息
     * @param request
     * @return
     * @throws Exception
     */
    public Object getBusinessById(HttpServletRequest request) {
        int businessId = Integer.parseInt(request.getParameter("businessId"));
        BusinessService service = new BusinessServiceImpl();
        return service.getBusinessById(businessId);
    }
}
